/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package manager;

import entity.ServicePlan;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import session.stateless.ServicePlanSessionLocal;

/**
 *
 * @author Jacko
 */
public class ServicePlanManager {

    private ServicePlanSessionLocal servicePlanSessionLocal;

    public ServicePlanManager() {
    }

    public ServicePlanManager(ServicePlanSessionLocal servicePlanSessionLocal) {
        this.servicePlanSessionLocal = servicePlanSessionLocal;
    }

    public List<ServicePlan> getAllServicePlan() {
        System.out.println("I'm getting my Service Plans out...");
        return servicePlanSessionLocal.getAllServicePlan();
    }

    public List<ServicePlan> modifyServicePlan() {

         return servicePlanSessionLocal.modifyServicePlan(); 
    }

    public Long addServicePlan(HttpServletRequest request) {
        String planName = request.getParameter("planName");
        Double mthFee = Double.valueOf(request.getParameter("mthFee"));
        Double comm1 = Double.valueOf(request.getParameter("comm1"));
        Double comm2 = Double.valueOf(request.getParameter("comm2"));
        Double init_Fee = Double.valueOf(request.getParameter("init_Fee"));
        Double perUnitFee = Double.valueOf(request.getParameter("perUnitFee"));

        
        return servicePlanSessionLocal.addServicePlan(planName, mthFee, comm1,
                comm2, init_Fee, perUnitFee);
    }
}

